function ActorManager(){}

ActorManager.prototype = {
    // Actorの追加
    addActor: function(actor){
        this.list.push(actor);
    },
    // 全Actorの描画
    drawAllActor: function(){
        var matrixStack = this.matrixStack;
        var shaderManager = this.shaderManager;
        var list = this.list;
        for (var i in list){
            var actor = list[i];
            matrixStack.push(actor.matrix);
            shaderManager.setup(actor.model);
            actor.model.drawFunc(actor.model);
            matrixStack.pop();
        }
    },
    // 全Actorの登録された処理の実行
    execAllActor: function(){
        var list = this.list;
        for (var i in list){
            var actor = list[i];
            if (actor.exec){
                actor.exec();
            }
        }
    },
    // 3軸ラインモデルの登録(debug)
    setAxisModel: function(model){
        this.axisModel = model;
    },
    // 全Actorの行列をaxisモデルで表示
    drawAllActorAxis: function(){
        var matrixStack = this.matrixStack;
        var shaderManager = this.shaderManager;
        var list = this.list;
        var axisModel = this.axisModel;
        shaderManager.setup(axisModel);
        for (var i in list){
            var actor = list[i];
            matrixStack.push(actor.matrix);
            shaderManager.setup(axisModel);
            axisModel.drawFunc(axisModel);
            matrixStack.pop();
        }
    }
};

ActorManager.create = function(matrixStack, shaderManager)
{
    var actorMan = new ActorManager();
    actorMan.list = [];
    actorMan.matrixStack = matrixStack;
    actorMan.shaderManager = shaderManager;
    return actorMan;
}

function Actor(){}

Actor.create = function(matrix, model){
    var actor = new Actor();
    actor.matrix = matrix;
    actor.model = model;

    return actor;
}
